package com.example.demo.Controller.Rate;

import com.example.demo.Bean.R;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.demo.ServiceImpl.Rate.RateServiceImpl;
import com.example.demo.Entity.Rate.Rate;
import com.example.demo.ServiceImpl.Topic.TopicServiceImpl;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/rate")
public class RateController {
    @Resource
    private RateServiceImpl rateService;
    @PostMapping
    public Boolean save(@RequestBody Rate rate) {
        return rateService.saveOrUpdate(rate);
    }

    @DeleteMapping("/{id}")
    public Boolean delete(@PathVariable(value = "id") Integer id) {

        return rateService.removeById(id);
    }

    @GetMapping
    public R findAll() {
        return R.ok().put("rateList", rateService.list());
    }
}